package com.mh.web.utils;

import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.DeserializationContext;
import org.codehaus.jackson.map.JsonDeserializer;

public class DateJsonDeserializer extends JsonDeserializer<Date> {
	
	private static final SimpleDateFormat dateFormat = new SimpleDateFormat(
	"dd-MM-yyyy HH:mm:ss");


	@Override
	public Date deserialize(JsonParser jp, DeserializationContext arg1)
			throws IOException, JsonProcessingException {
		Date dt = null;
		try {
			dt = dateFormat.parse(jp.getText());
		} catch (ParseException e) {
			
		}
		return dt;
	}

}
